package com.code.generation.exception;

import com.code.generation.vo.RespVO;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @ProjectName: codegeneration
 * @Package: com.code.generation.exception
 * @Description:
 * @Author: DongJW
 * @CreateDate: 2020/11/29 11:23
 * @Version: 1.0
 */
@ControllerAdvice
public class CommonExceptionHandler {


    @ExceptionHandler(Exception.class)
    public ResponseEntity<RespVO> handleException(Exception e) {

        RespVO respVO = new RespVO();
        respVO.setStatus(10000);
        respVO.setMessage(e.getMessage());
        return ResponseEntity.status(10000).body(respVO);
    }
}
